import java.util.*;

class User{
    String name;

    public User(String name){
        this.name = name;
    }

    @Override
    public String toString() {
        return "user{" + "name='" + name + '\'' + '}';
    }
}

public class UserManager {
    ArrayList<User> users = new ArrayList<User>();
    public void addUser(User user){
        users.add(user);
    }

    public void delUser(User user){
        users.remove(user);
    }
    public void showAll(){
        for(User u: users)
            System.out.println(u);
    }
     public static void main(String[] args) {
//        UserManager um = new UserManager();
//        um.addUser(new User("good1"));
//         um.addUser(new User("good2"));
//         um.addUser(new User("good3"));
//         um.addUser(new User("good4"));
//         um.showAll();

         UserManager um = new UserManager();
         um.addUser(new User("good1"));
         User u1 = new User("good2");
         um.addUser(new User("good2"));
         um.addUser(new User("good3"));
         um.addUser(new User("good4"));
         um.showAll();
         System.out.println("------------------");
         um.delUser(new User("good2"));
         um.showAll();
         //为什么删不掉-》equal
         System.out.println("------------------");
         um.delUser(u1);
         um.showAll();


     }

 }